/**
 * Created by jt on 2017/5/8.
 */
import "./index.less";
// import "../../../unit/common/js/common/main_portal.js";

var projId = getArgs().id;

jQuery('h3.supplierInfo span').click(function () {
    var index = jQuery(this).index();
    jQuery('h3.supplierInfo span').removeClass('active').eq(index-1).addClass('active');
    jQuery('.basicInfo').hide().eq(index-1).show();
});

var projId = getArgs().id;

$.ajax({
    url: HOST_ADDR + '/cpmp/splrChrm/getSplrChrm/'+projId,
    type: 'get',
    dataType: 'json',
    contentType: "application/json",
    success: function (resp) {
        if (resp.success) {
            console.log(resp);
            var hasCreditCode = '否';
            if (resp.data.hasCreditCode == '1') {
                hasCreditCode='是';
            }
            if(resp.data.crdtCod == null){
                resp.data.crdtCod='';
            }
            if(resp.data.dbusiLice == null){
                resp.data.dbusiLice='';
            }
            if(resp.data.lglUser == null){
                resp.data.lglUser='';
            }
            if(resp.data.lglIdntCad == null){
                resp.data.lglIdntCad='';
            }
            if(resp.data.regCptl == null){
                resp.data.regCptl='';
            }
            if(resp.data.rgstAddr == null){
                resp.data.rgstAddr='';
            }
            if(resp.data.orgCod == null){
                resp.data.orgCod='';
            }
            if(resp.data.taxCod == null){
                resp.data.taxCod='';
            }
            jQuery('.basicInfo1').html('<tbody><tr>' +
                '<td width="16%">企业名称：</td><td colspan="2">'+resp.data.fullNam+'</td> ' +
                '<td width="16%">社会统一信用代码：</td><td colspan="2">'+resp.data.crdtCod+'</td></tr><tr>' +
                '<td width="16%">营业执照号：</td><td colspan="2">'+resp.data.dbusiLice+'</td>' +
                '<td width="16%">是否三证合一：</td><td colspan="2">'+hasCreditCode+'</td></tr> <tr>' +
                '<td width="16%">法人代表：</td><td colspan="2">'+resp.data.lglUser+'</td>' +
                '<td width="16%">法人身份证：</td><td colspan="2">'+resp.data.lglIdntCad+'</td></tr><tr>' +
                '<td width="16%">注册资本：</td><td colspan="2">'+resp.data.regCptl+'</td>' +
                '<td width="16%">注册地址：</td><td colspan="2">'+resp.data.rgstAddr+'</td></tr><tr>' +
                '<td width="16%">组织机构代码：</td><td colspan="2">'+resp.data.orgCod+'</td>' +
                '<td width="16%">税务登记证号：</td><td colspan="2">'+resp.data.taxCod+'</td></tr></tbody>');

            for (var i = 0; i< resp.data.iconItems.length;i++) {
                jQuery('.basicInfo2').append('<div class="figure"><img src="'+HOST_FILE+resp.data.iconItems[i].chrmIcon+'">' +
                    '<p class="title">'+resp.data.iconItems[i].iconTitle+'</p></div>');
            }
        }
        else {
            alert(resp.msgInf);
        }
    },
    error: function (err) {
        alert('系统错误！');
    }
});